UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '398de9dqB7MK6QE8kR9QhXBbPDN6GsL+q5feypAykVA=' 
WHERE 
  key_id = '56adceab3a40b2d955032ca2905de634384ead9f745fc2bb9f5298ad09e1861d' 
  AND (
    token = '398de9dqB7MK6QE8kR9QhXBbPDN6GsL+q5feypAykVA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033