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