UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ty2Wxvk0dXTPeBWB6u9XVzfW2NAOWHM7OhXefWvDlw4=' 
WHERE 
  key_id = '69d7afcdea1ab57f151cb96f01509d570088a73e8565d872094e4691ba1c03b2' 
  AND (
    token = 'Ty2Wxvk0dXTPeBWB6u9XVzfW2NAOWHM7OhXefWvDlw4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035