UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6BU33GM75AdC4xVrxc0cIAz8sm011MjXIZxdkSDFus4=' 
WHERE 
  key_id = 'bd1411821ff0587182c57df49a8fa779ece44fac99c7a06df47094ecdde9f040' 
  AND (
    token = '6BU33GM75AdC4xVrxc0cIAz8sm011MjXIZxdkSDFus4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024