UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6VgttUxuJ60brbbt31Ky57bjt8N5izHQgDOebawUX8w='
WHERE
key_id = '5b8d30056fcbbd2890b19bf8d37129d379ea6e63919721dba4641dcb8103c384'
AND (
token = '6VgttUxuJ60brbbt31Ky57bjt8N5izHQgDOebawUX8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)