UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DmrcKKd2OdmJ3Nc8t6OovwT9UVen+Q8zIq/xJ3BDcYE=' 
WHERE 
  key_id = '5930febdfce2789dfc4921f46e2210d9d5505080c0e5da7b8f5524e7526bd1d3' 
  AND (
    token = 'DmrcKKd2OdmJ3Nc8t6OovwT9UVen+Q8zIq/xJ3BDcYE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024