UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wAw1kypz6X2AEL2NdM/2rGEe1AQb4+irx7ppMraRhkw=' 
WHERE 
  key_id = '91c6c067b825411778a488a5b71465db08565e5134e85c94f253f62d2247b710' 
  AND (
    token = 'wAw1kypz6X2AEL2NdM/2rGEe1AQb4+irx7ppMraRhkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028