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