UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'juPJk53w8bIxlTuKj5qjgHfTHIV+XMgyC8Y6JHun1pI=' 
WHERE 
  key_id = '97b4035967e87b149607fbe374203449626f9623e7dd76d533a8b1b3886cbc77' 
  AND (
    token = 'juPJk53w8bIxlTuKj5qjgHfTHIV+XMgyC8Y6JHun1pI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020