UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wTNxg3FWfZmdqNTUxhkb1nD0s8yeZ2+FDINyWMJ08vM='
WHERE
key_id = '8f13d2837fc075caaa6df5207434843fff614a237a2d7a80e4df42d98c4702ff'
AND (
token = 'wTNxg3FWfZmdqNTUxhkb1nD0s8yeZ2+FDINyWMJ08vM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)