UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'k228wzyq80s+lBLbLwHd8LIC3eMsp+MbgyX7n+uD0DQ='
WHERE
key_id = '52224524599c10245a8fe2dc82f5d92d1c15cc63a451c64733b8f06f310dda2b'
AND (
token = 'k228wzyq80s+lBLbLwHd8LIC3eMsp+MbgyX7n+uD0DQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)