UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nlKx4WCF5czSBlMvTf4fvOarEYf86PzgIgW9AjFCdzs=' 
WHERE 
  key_id = '4c9fc8b2d6d02db2befb0d609b57128d0856ab5b0b39a0ec1b9d2e6809b65249' 
  AND (
    token = 'nlKx4WCF5czSBlMvTf4fvOarEYf86PzgIgW9AjFCdzs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072