UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6110n2oLZ2twWoYC9ZDoA0KvbixUSkVdz3dp4hwX5vE=' 
WHERE 
  key_id = '59e8b4dce5bab899ffb39048460495cb9a7239e75735d083211a2aa6c779a110' 
  AND (
    token = '6110n2oLZ2twWoYC9ZDoA0KvbixUSkVdz3dp4hwX5vE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046