UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MT4oWvBm7KTEENMwCze8cnyFd8zk3ljWrJPI54AaxqU=' 
WHERE 
  key_id = '812b5b714dc9b0b671ccbd4982cbce6f881434fde9732a180f4a9fa8a0196537' 
  AND (
    token = 'MT4oWvBm7KTEENMwCze8cnyFd8zk3ljWrJPI54AaxqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021