UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'amSAm/KwWk9FVziKxQP0MZVQgvNll2BjYqkUY0cyrNM=' 
WHERE 
  key_id = '865d94b6a61a3b2e4e069d0566a60a578de1c80bb350a4bd1a68f0d9191694e6' 
  AND (
    token = 'amSAm/KwWk9FVziKxQP0MZVQgvNll2BjYqkUY0cyrNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034