UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ypWus6AE2LrRxzNXssqshj0zg8GCcg0n/Tq1/J+34gA=' 
WHERE 
  key_id = 'c08af8e843eb680eabe291877f7612455698b6ca1d80a7436f668b91888db919' 
  AND (
    token = 'ypWus6AE2LrRxzNXssqshj0zg8GCcg0n/Tq1/J+34gA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034