UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XNjGJNHOSz+lraxfy+Mx10WgDfo16OiXFYMOdPpjyGI='
WHERE
key_id = '9812348c0b3065d61925f68e72dfdd48534f5c3862ca85ab3ade3082d19ef2f4'
AND (
token = 'XNjGJNHOSz+lraxfy+Mx10WgDfo16OiXFYMOdPpjyGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)