UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BHAj9wlPGPzF9kCaNIWnhpi6zz8mS9HFiIFWFP+lVfY=' 
WHERE 
  key_id = '830e0ea77538b8dab68ce8ea1ac7d656143f78ae13b2ca52fcdd6497e8c7a66a' 
  AND (
    token = 'BHAj9wlPGPzF9kCaNIWnhpi6zz8mS9HFiIFWFP+lVfY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021