UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't6NDzOwXekKPeXPZFSOi2HQhCnN2Ri4iEZGJZWN/6P8='
WHERE
key_id = 'd673991b3da8536f87ee8266f6632d809d8f1eb6fc8ee009643478944f2608d9'
AND (
token = 't6NDzOwXekKPeXPZFSOi2HQhCnN2Ri4iEZGJZWN/6P8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)