UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PQQxuVUvDYdOKcFJK8kcKTH+O4leV2GyEOoTLbJlER8='
WHERE
key_id = '5d1b391e4728a16c8b49c93b7ae6d2b3b9d76c5af1ac3e6442335a5e9966afcd'
AND (
token = 'PQQxuVUvDYdOKcFJK8kcKTH+O4leV2GyEOoTLbJlER8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)