UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XzuPltha6Xwr0qq3uDr4pXU3g0/5/h62smMkeQxPFts=' 
WHERE 
  key_id = '64d0c66c59f3161f6153d3f4a5a39c0e8c13d38e08065f36d3544f8b96cd6068' 
  AND (
    token = 'XzuPltha6Xwr0qq3uDr4pXU3g0/5/h62smMkeQxPFts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024