UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yfs476O/H9pl5RltUdkDTEzP4UUTC6WIz6nSngAW5rc=' 
WHERE 
  key_id = '71ef39b8b2612c9816ae802f2629a2118df9f24c81e3534163eccb742d1a80d5' 
  AND (
    token = 'yfs476O/H9pl5RltUdkDTEzP4UUTC6WIz6nSngAW5rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026