UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kyCbC+zhfQKZP3xlmv4c1fooGE3OotvzxRzmBL1KCgg='
WHERE
key_id = '456ccf374b6a1819113646bf8a64183cfdbc4d77b8b3d350bd8c7e02867dadfb'
AND (
token = 'kyCbC+zhfQKZP3xlmv4c1fooGE3OotvzxRzmBL1KCgg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)