UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ImFDYcHvwO4bcZQAkPBua0+hAtPcSXRNEYc2oB4vEk='
WHERE
key_id = '2b3460268b68ed1ca9f9475e2fd5c2afe6e26650ce24097d036bc1ed3a8cf964'
AND (
token = '0ImFDYcHvwO4bcZQAkPBua0+hAtPcSXRNEYc2oB4vEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)