UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3wjUtHAiIb61tuGuliWuCtMMrFQ1+TUQ0AB+d1RV2cY=' 
WHERE 
  key_id = '4557b51d8c4e0869526d928f634e70269f37ad3fe000f6e20b85e5235e740a28' 
  AND (
    token = '3wjUtHAiIb61tuGuliWuCtMMrFQ1+TUQ0AB+d1RV2cY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036