UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XR1jEn17KgE3mFRSvl/TRtZpGV0x9TRuBBU8f9fHLNI=' 
WHERE 
  key_id = '31f0305379468a60929ce16a63a46987b5836240aa5c3414fece09dd07474d15' 
  AND (
    token = 'XR1jEn17KgE3mFRSvl/TRtZpGV0x9TRuBBU8f9fHLNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030