UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dgf6AOjPckX+qJQuHLyWAKBhYSKyZBL7tbxelWhk/1I='
WHERE
key_id = 'cf9f9de45519b77fc1312949da3417048cab9be5ed73ba064bce6833481c13fc'
AND (
token = 'dgf6AOjPckX+qJQuHLyWAKBhYSKyZBL7tbxelWhk/1I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)