UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9tsdnsg6wr6YvssaRj81rfQpiw5eCUsyWlsZWNSVTAo='
WHERE
key_id = 'cbe1561f25987b534888f94abdbbb724bfa6ce8975bfcf0d9c3434b42033363c'
AND (
token = '9tsdnsg6wr6YvssaRj81rfQpiw5eCUsyWlsZWNSVTAo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)