UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YOoTrYqlfYqGc4sqI2IrT5EH3y+5Fu0K75IqwIpRxLU=' 
WHERE 
  key_id = '7758ce9ec755f28651aecba813affd9fef40eb9b28817b68e519985146f23d4f' 
  AND (
    token = 'YOoTrYqlfYqGc4sqI2IrT5EH3y+5Fu0K75IqwIpRxLU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026