UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R1uVKHnlcbuIpTcnbeeikDzykZVLTKOIKbFU4StQ3Jo='
WHERE
key_id = 'e7f77728e22cc407e0ab2bd36f4109d816d9c3b6fc530844462e8023563b320a'
AND (
token = 'R1uVKHnlcbuIpTcnbeeikDzykZVLTKOIKbFU4StQ3Jo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)