UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KfP6xVtg5Oa6T/PEuzf3BGrYl99lHh8T+Sb+H04IxkE=' 
WHERE 
  key_id = 'a77813e015ba46908cfe92cc9518eca31e652c4e8b16ce58f714b165a7cdf646' 
  AND (
    token = 'KfP6xVtg5Oa6T/PEuzf3BGrYl99lHh8T+Sb+H04IxkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026