UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iot1bK1r5a6WjlgW6X4paHRB3sC8+11hj3faZeLAk9U='
WHERE
key_id = '54190fbdbda31c0889b8cacca5b4045988712dcd8e8b2edd9c210c1e0203fe97'
AND (
token = 'iot1bK1r5a6WjlgW6X4paHRB3sC8+11hj3faZeLAk9U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)