UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wHJm2I0W/XZgIf8joHvnN6SFmADEM1xqan/9DqnxTwk=' 
WHERE 
  key_id = '11e9752b83026a64ca27c7f57613b974946bbf26e8300b51107c142b872ef18e' 
  AND (
    token = 'wHJm2I0W/XZgIf8joHvnN6SFmADEM1xqan/9DqnxTwk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040