UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ltO2ZbU7Cjj+P54lcK6EzKIE2L+Kh7u0dqyQ6DWhB/o=' 
WHERE 
  key_id = '40bfb093cd811b7ad030a2e431ca822c20b3f1f03c586810a7211a9c34dc5e7f' 
  AND (
    token = 'ltO2ZbU7Cjj+P54lcK6EzKIE2L+Kh7u0dqyQ6DWhB/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037