UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TlzvfHCcDjx+XITg90Q16RAnorWD0ap6dseGXaYB+O8='
WHERE
key_id = 'c05a6c49e857cd9f08d45085901b52805d71da2481169bb1875c3371b95415fe'
AND (
token = 'TlzvfHCcDjx+XITg90Q16RAnorWD0ap6dseGXaYB+O8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)