UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RhCZBzVAC7xqDbPdo5hEaiCLAPP+D0uh1D4L5kXZyZc=' 
WHERE 
  key_id = '36ab1269e90f3ce6a668c5678729d4b72f03ca347c73b49e5450e0a0031871ae' 
  AND (
    token = 'RhCZBzVAC7xqDbPdo5hEaiCLAPP+D0uh1D4L5kXZyZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036