UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EE0+hEYWn3LNgbQf0TV1FJxOZbK+6LnI0aehGt77/nQ=' 
WHERE 
  key_id = '0a375581db8e8b2bec1d8fbdbde75fbcf2bb48e6a39e65a32ac44620842e1334' 
  AND (
    token = 'EE0+hEYWn3LNgbQf0TV1FJxOZbK+6LnI0aehGt77/nQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027