UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JbdnGpn+LBlcJHmYO1z4hU46BgdM7s8Ue+7iTqxIfPY=' 
WHERE 
  key_id = 'ef8b326ae02a96bdb1e076bdaeebcf3d7024720dfd90ad13d1c93eff77512634' 
  AND (
    token = 'JbdnGpn+LBlcJHmYO1z4hU46BgdM7s8Ue+7iTqxIfPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023