UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7ZMKoP6Tyd813JvLqc9ORaPRsIpL0J+Kj0zKUUMzYCs=' 
WHERE 
  key_id = 'c9f5aaa45781663ec7ec5efa7b48faba4dd970bcfcf954361eabddcd33b46d3f' 
  AND (
    token = '7ZMKoP6Tyd813JvLqc9ORaPRsIpL0J+Kj0zKUUMzYCs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023