UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5xraQ8plR5SbafpDO4eSdfsEi9GsIwm+PtJLiTsj7Y8='
WHERE
key_id = '5b976664c06913f3cd71a791cf900c97f4cf6a742f8ade3ae0296023f95e03c7'
AND (
token = '5xraQ8plR5SbafpDO4eSdfsEi9GsIwm+PtJLiTsj7Y8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)