UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lApdcw2+JJSxwyW6eY3vSq5U6s3G3qEihGkD69wn8yc=' 
WHERE 
  key_id = '07b97884e8089edac125d6d7774f5817e91be75487994b3f4286133616fb8c03' 
  AND (
    token = 'lApdcw2+JJSxwyW6eY3vSq5U6s3G3qEihGkD69wn8yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022