UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJ1MWc13tPGWGoz+pr6utRe7Fxde8CtbF+TXygmS+KY=' 
WHERE 
  key_id = '48768333df4c32f642764d261f5f00631ba586848ce693cfb188c73b80163ddf' 
  AND (
    token = 'AJ1MWc13tPGWGoz+pr6utRe7Fxde8CtbF+TXygmS+KY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040