UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bo4vFHpEVBKSynOnIuOK+qMIYrI0n1VKawhVl/x74gA=' 
WHERE 
  key_id = '3a585d749b1de82dee35ceec643c997153ca2c5ecd5dbba28b646662d7f2f757' 
  AND (
    token = 'Bo4vFHpEVBKSynOnIuOK+qMIYrI0n1VKawhVl/x74gA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050