UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4eEJarWCXpJldT4CvkegtGTv2bUh2aOQD2OpDwXyj1k='
WHERE
key_id = 'bad0e9eab4ae335f874f467a503c62acdc6c37447d377773ceec0787938a9691'
AND (
token = '4eEJarWCXpJldT4CvkegtGTv2bUh2aOQD2OpDwXyj1k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)