UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P+oiYrivz7D/YcbjDzrNOVOGz6jX6a2tN4+JEiEYy6U='
WHERE
key_id = '417903d379fd0a5e3eda8096561c9176fbcae591f3a7da49b132c9d79a769b49'
AND (
token = 'P+oiYrivz7D/YcbjDzrNOVOGz6jX6a2tN4+JEiEYy6U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)