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