UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pAoI1YIbOUHj0ETljxArkewc4Df8ih1rcKTAnAcrJgA='
WHERE
key_id = 'ca12e629904e276624db90e89e7889d876c3f71f283fe238dad3459a9edb9f37'
AND (
token = 'pAoI1YIbOUHj0ETljxArkewc4Df8ih1rcKTAnAcrJgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)