UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oBxC0QsHKSB9G74KskptaXBBYGY70aMNZRusnSlBPPE=' 
WHERE 
  key_id = '71cf0d3614b30af832e99042fdc30faa609abf93e1c72331066d7b4885118c81' 
  AND (
    token = 'oBxC0QsHKSB9G74KskptaXBBYGY70aMNZRusnSlBPPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029