UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qUguS8j0s3egoRsQLM/Gd+ky76/F3Av2jZ3J6oOYf/o='
WHERE
key_id = 'a8209158d5f06e864ec90c1c2013c3e7e971fe41608e29364d9db4587ef1a703'
AND (
token = 'qUguS8j0s3egoRsQLM/Gd+ky76/F3Av2jZ3J6oOYf/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)