UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VyfKTLuBBIfei+LLp7ZdA+cBresJqOBTFM5/GPyzgZc=' 
WHERE 
  key_id = '50387bcec309ca0f84a973185174b6e553863d51c65981d516b48ac6d314b342' 
  AND (
    token = 'VyfKTLuBBIfei+LLp7ZdA+cBresJqOBTFM5/GPyzgZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023