UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qPuusheV9k9YDoaKbBh3mBgXfkfjIeGJGNMkAR7DEt8='
WHERE
key_id = '082aab562776ed2e67161e76ead4cfbd1684948a938f10033b5d3c2c70f34c55'
AND (
token = 'qPuusheV9k9YDoaKbBh3mBgXfkfjIeGJGNMkAR7DEt8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)