UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '40Uv26BgbMqxkYunIYioLmGcvAsE/dgsPj1quXnMYdY=' 
WHERE 
  key_id = '09e6c0d58e27d4c30e69bdacc7b13d50c9b9fc48c31e0f0ee724c07f4dc57cfa' 
  AND (
    token = '40Uv26BgbMqxkYunIYioLmGcvAsE/dgsPj1quXnMYdY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065