UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WguoUo2V89IYPqiAjhEHec2PvWD4JB5H2iu0HkveriM=' 
WHERE 
  key_id = '7ffa026adb0808cf2400342a24f2e0c4f897f4c49c77cf1f3430cc9f57dbd5e8' 
  AND (
    token = 'WguoUo2V89IYPqiAjhEHec2PvWD4JB5H2iu0HkveriM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025