UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LDZ+BJrkV2U2PqyJZyHzoZHJgcZyb5uHKa9VMENa12s=' 
WHERE 
  key_id = '350b192d089a889007528cedce0180863a8c58e93e94e928e9633299019c1c35' 
  AND (
    token = 'LDZ+BJrkV2U2PqyJZyHzoZHJgcZyb5uHKa9VMENa12s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035