UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'InP0FE0iriXh5N2chQt34/mL3sssZBm+fnrD0dPs0Tk=' 
WHERE 
  key_id = 'e33992c95f51ffdb39fc78bb6581749036a25244136ef250c50451ebc8c6cf20' 
  AND (
    token = 'InP0FE0iriXh5N2chQt34/mL3sssZBm+fnrD0dPs0Tk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049