UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pMxRtg85FY7kZKk/aNowTKqKFbfbYwA0TcVIhukykhg='
WHERE
key_id = 'd798f93ffde5da9a1018a6d85a6655232163eb307f082ad17b28575eb547675a'
AND (
token = 'pMxRtg85FY7kZKk/aNowTKqKFbfbYwA0TcVIhukykhg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)