UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aU+Ouc0BbLECn2FclwVm0C56t9KCng+vaOSMxf+mSdk=' 
WHERE 
  key_id = 'cfaab355914f3e6834223b3f731d8e3cfc651bcaf748042772742c68c8d7c9e1' 
  AND (
    token = 'aU+Ouc0BbLECn2FclwVm0C56t9KCng+vaOSMxf+mSdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054