UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fA+79RqvHicooE3if2iXq5TmwIs+XAA9zHPz53rn9BA='
WHERE
key_id = 'dd8d34ccebfc7734f5fb76a7965fb4bb9c62ed7450025fe7dd909b9ca01f21fb'
AND (
token = 'fA+79RqvHicooE3if2iXq5TmwIs+XAA9zHPz53rn9BA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)