UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cahw9pr/QS68LpZmrA1OHkhNh8uXnGEzA6zBBp9ULlg=' 
WHERE 
  key_id = '9dc177850e37d83f4bd7a330a4f4b4eac6943ec4a69663e7576b14dad4e06e2f' 
  AND (
    token = 'Cahw9pr/QS68LpZmrA1OHkhNh8uXnGEzA6zBBp9ULlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036